namespace SinaFinanceBaseClassLibrary
{
    using System;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Media;

    public class StockTopFiveChangesItem : UserControl
    {
        public double ActualHeight = 0.0;
        private Canvas canvas = new Canvas();
        private int index = 0;
        private string stockPrice = string.Empty;

        public Canvas RenderStockTopFiveChangesItem()
        {
            LinearGradientBrush brush = new LinearGradientBrush {
                StartPoint = new Point(0.5, 0.0),
                EndPoint = new Point(0.5, 1.0)
            };
            GradientStop stop = new GradientStop();
            GradientStop stop2 = new GradientStop();
            stop.Color = Color.FromArgb(0xff, 0xec, 0xff, 0xff);
            stop2.Color = Color.FromArgb(0xff, 0xae, 0xbf, 0xc7);
            stop2.Offset = 1.0;
            brush.GradientStops.Add(stop);
            brush.GradientStops.Add(stop2);
            TextBlock block = new TextBlock {
                Text = this.stockPrice,
                FontSize = 11.0,
                Foreground = brush
            };
            this.canvas.Children.Add(block);
            this.ActualHeight = block.ActualHeight;
            return this.canvas;
        }

        public int Index
        {
            get
            {
                return this.index;
            }
            set
            {
                this.index = value;
            }
        }

        public string StockPrice
        {
            get
            {
                return this.stockPrice;
            }
            set
            {
                this.stockPrice = value;
            }
        }
    }
}
